package com.chen.rocker;

import com.chen.disruptor.DisruptorTemplate;
import com.chen.model.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.stereotype.Service;

/**
 * @Author: chen
 * @Date: 2021/5/24 3:27 PM
 * @Version 1.0
 */
@Service
public class MessageConsumerListener {

    @Autowired
    private DisruptorTemplate disruptorTemplate;

    /**
     * 监听消息管道中的信息
     */
    @StreamListener("order_in")
    public void handleMessage(Order order) {
        disruptorTemplate.onData(order);
    }
}
